import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../util/ColorHelper.dart';
import 'TextComponent.dart';

class ButtonComponent{
  static Widget getBtn({
    required String text,
    double vPadding = 0,
    Function()? onPressed
}){
    return _buildBtn(
        text,
        vPadding: vPadding,
        onPressed: onPressed
    );
  }

  static Widget _buildBtn(String text, {
    double vPadding = 0,
    Function()? onPressed
  }) => Container(
    padding: EdgeInsets.symmetric(vertical: vPadding.h),
    child: ElevatedButton(
      style: ButtonStyle(
        shadowColor: WidgetStateProperty.all(
            ColorHelper.transparent),
        backgroundColor: WidgetStateProperty.all(
            ColorHelper.transparent),
        minimumSize: WidgetStateProperty.all(Size.zero),
        tapTargetSize: MaterialTapTargetSize.shrinkWrap,
      ),
      onPressed: () {
        onPressed?.call();
      },
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        children: [
          TextComponent.getText(
              text: text
          )
        ],
      ),
    ),
  );
}
